/**
 * 本文件仅适用于W25Qxxx系列Flash
 * 使用前应再STM32CubeMX里配置SPI功能和CS引脚
 */

#ifndef W25Qxxx_H
#define W25Qxxx_H

#include "main.h"

#define Flash_SPI_Handle hspi2

// #define USE_W25Q16
// #define USE_W25Q32
#define USE_W25Q64
// #define USE_W25Q128
// #define USE_W25Q256
// #define USE_W25Q512

/** config end **/

#if !defined(Flash_SPI_Handle) || !defined(Flash_CS_GPIO_Port) || !defined(Flash_CS_Pin)
#error "Prese define: Flash_SPI_Handle Flash_CS_GPIO_Port Flash_CS_Pin"
#endif

extern uint16_t W25Qxxx_Read_ID(void);
extern void W25Qxxx_Sector_Erase(uint32_t Address);
extern void W25Qxxx_Wait_Free(void);
extern void W25Qxxx_Read_Data(uint32_t Address, uint8_t *Buf, uint32_t Len);
extern void W25Qxxx_Write(uint32_t Address, uint8_t *Buf, uint32_t Len);

#endif
